<%--
  Created by IntelliJ IDEA.
  User: Legion
  Date: 2019/10/18
  Time: 15:30
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>发表问题 编辑问题 公用</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="keywords" content="fly,layui,前端社区">
    <meta name="description" content="Fly社区是模块化前端UI框架Layui的官网社区，致力于为web开发提供强劲动力">
    <link rel="stylesheet" href="${pageContext.servletContext.contextPath}/res/layui/css/layui.css">
    <link rel="stylesheet" href="${pageContext.servletContext.contextPath}/res/css/global.css">
</head>
<body>

<div class="fly-header layui-bg-black">
    <div class="layui-container">
        <a class="fly-logo" href="/">
            <img src="${pageContext.servletContext.contextPath}/res/images/logo.png" alt="layui">
        </a>
        <ul class="layui-nav fly-nav layui-hide-xs">
            <li class="layui-nav-item layui-this">
                <a href="/"><i class="iconfont icon-jiaoliu"></i>交流</a>
            </li>
            <li class="layui-nav-item">
                <a href="../case/case.html"><i class="iconfont icon-iconmingxinganli"></i>案例</a>
            </li>
            <li class="layui-nav-item">
                <a href="http://www.layui.com/" target="_blank"><i class="iconfont icon-ui"></i>框架</a>
            </li>
        </ul>

        <ul class="layui-nav fly-nav-user">
            <c:if test="${fly_user == null}">
                <!-- 未登入的状态 -->
                <li class="layui-nav-item">
                    <a class="iconfont icon-touxiang layui-hide-xs" href="user/login.html"></a>
                </li>
                <li class="layui-nav-item">
                    <a href="${pageContext.servletContext.contextPath}/forward/login">登入</a>
                </li>
                <li class="layui-nav-item">
                    <a href="${pageContext.servletContext.contextPath}/forward/reg">注册</a>
                </li>
                <li class="layui-nav-item layui-hide-xs">
                    <a href="/app/qq/" onclick="layer.msg('正在通过QQ登入', {icon:16, shade: 0.1, time:0})" title="QQ登入"
                       class="iconfont icon-qq"></a>
                </li>
                <li class="layui-nav-item layui-hide-xs">
                    <a href="/app/weibo/" onclick="layer.msg('正在通过微博登入', {icon:16, shade: 0.1, time:0})" title="微博登入"
                       class="iconfont icon-weibo"></a>
                </li>
            </c:if>

            <c:if test="${fly_user != null}">
                <!-- 登入后的状态 -->
                <li class="layui-nav-item">
                        <%--头像部分--%>
                    <a class="fly-nav-avatar" href="javascript:;">
                        <cite class="layui-hide-xs">${fly_user.nickName}</cite>
                        <i class="iconfont icon-renzheng layui-hide-xs" title="${fly_user.id}"></i>
                        <i class="layui-badge fly-badge-vip layui-hide-xs">VIP3</i>
                        <img src="${pageContext.servletContext.contextPath}/res/images/avatar/${fly_user.avatar}">
                    </a>
                    <dl class="layui-nav-child">
                        <dd><a href="${pageContext.servletContext.contextPath}/set"><i class="layui-icon">&#xe620;</i>基本设置</a>
                        </dd>
                        <dd><a href="user/message.html"><i class="iconfont icon-tongzhi" style="top: 4px;"></i>我的消息</a>
                        </dd>
                        <dd><a href="${pageContext.servletContext.contextPath}/home"><i class="layui-icon"
                                                                                        style="margin-left: 2px; font-size: 22px;">&#xe68e;</i>我的主页</a>
                        </dd>
                        <hr style="margin: 5px 0;">
                        <dd><a href="${pageContext.servletContext.contextPath}/user/logout" style="text-align: center;">退出</a>
                        </dd>
                    </dl>
                </li>
            </c:if>
        </ul>
    </div>
</div>

<div class="layui-container fly-marginTop">
    <div class="fly-panel" pad20 style="padding-top: 5px;">
        <!--<div class="fly-none">没有权限</div>-->
        <div class="layui-form layui-form-pane">
            <div class="layui-tab layui-tab-brief" lay-filter="user">
                <ul class="layui-tab-title">
                    <li class="layui-this">发表新帖<!-- 编辑帖子 --></li>
                </ul>
                <div class="layui-form layui-tab-content" id="LAY_ucm" style="padding: 20px 0;">
                    <div class="layui-tab-item layui-show">
                        <form id="articleForm" action="${pageContext.servletContext.contextPath}/article/add"
                              method="post">
                            <div class="layui-row layui-col-space15 layui-form-item">
                                <div class="layui-col-md3">
                                    <label class="layui-form-label">所在专栏</label>
                                    <div class="layui-input-block">
                                        <select lay-verify="required" name="class" lay-filter="column">
                                            <option></option>
                                            <c:if test="${cateList != null}">
                                                <c:forEach items="${cateList}" var="category">
                                                    <option value="${category.id}">${category.cateNameZh}</option>
                                                </c:forEach>
                                            </c:if>
                                        </select>
                                    </div>
                                </div>
                                <div class="layui-col-md9">
                                    <label for="L_title" class="layui-form-label">标题</label>
                                    <div class="layui-input-block">
                                        <input type="text" id="L_title" name="title" required lay-verify="required"
                                               autocomplete="off" class="layui-input">
                                        <!-- <input type="hidden" name="id" value="{{d.edit.id}}"> -->
                                    </div>
                                </div>
                            </div>
                            <%--                            <div class="layui-row layui-col-space15 layui-form-item layui-hide" id="LAY_quiz">--%>
                            <%--                                <div class="layui-col-md3">--%>
                            <%--                                    <label class="layui-form-label">所属产品</label>--%>
                            <%--                                    <div class="layui-input-block">--%>
                            <%--                                        <select name="project">--%>
                            <%--                                            <option></option>--%>
                            <%--                                            <option value="layui">layui</option>--%>
                            <%--                                            <option value="独立版layer">独立版layer</option>--%>
                            <%--                                            <option value="独立版layDate">独立版layDate</option>--%>
                            <%--                                            <option value="LayIM">LayIM</option>--%>
                            <%--                                            <option value="Fly社区模板">Fly社区模板</option>--%>
                            <%--                                        </select>--%>
                            <%--                                    </div>--%>
                            <%--                                </div>--%>
                            <%--                                <div class="layui-col-md3">--%>
                            <%--                                    <label class="layui-form-label" for="L_version">版本号</label>--%>
                            <%--                                    <div class="layui-input-block">--%>
                            <%--                                        <input type="text" id="L_version" value="" name="version" autocomplete="off" class="layui-input">--%>
                            <%--                                    </div>--%>
                            <%--                                </div>--%>
                            <%--                                <div class="layui-col-md6">--%>
                            <%--                                    <label class="layui-form-label" for="L_browser">浏览器</label>--%>
                            <%--                                    <div class="layui-input-block">--%>
                            <%--                                        <input type="text" id="L_browser"  value="" name="browser" placeholder="浏览器名称及版本，如：IE 11" autocomplete="off" class="layui-input">--%>
                            <%--                                    </div>--%>
                            <%--                                </div>--%>
                            <%--                            </div>--%>
                            <div class="layui-form-item layui-form-text">
                                <div class="layui-input-block">
                                    <textarea id="L_content" name="content" required lay-verify="required"
                                              placeholder="详细描述" class="layui-textarea fly-editor"
                                              style="height: 260px;"></textarea>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">悬赏飞吻</label>
                                    <div class="layui-input-inline" style="width: 190px;">
                                        <select id="kiss" name="experience">
                                            <option value="20">20</option>
                                            <option value="30">30</option>
                                            <option value="50">50</option>
                                            <option value="60">60</option>
                                            <option value="80">80</option>
                                        </select>
                                    </div>
                                    <div id="kissMsg" class="layui-form-mid layui-word-aux">发表后无法更改飞吻</div>
                                </div>
                            </div>
                            <%--                            <div class="layui-form-item">--%>
                            <%--                                <label for="L_vercode" class="layui-form-label">人类验证</label>--%>
                            <%--                                <div class="layui-input-inline">--%>
                            <%--                                    <input type="text" id="L_vercode" name="vercode" required lay-verify="required" placeholder="请回答后面的问题" autocomplete="off" class="layui-input">--%>
                            <%--                                </div>--%>
                            <%--                                <div class="layui-form-mid">--%>
                            <%--                                    <span style="color: #c00;">1+1=?</span>--%>
                            <%--                                </div>--%>
                            <%--                            </div>--%>
                            <div class="layui-form-item">
                                <button class="layui-btn">立即发布</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<div class="fly-footer">
    <p><a href="http://fly.layui.com/" target="_blank">Fly社区</a> 2017 &copy; <a href="http://www.layui.com/"
                                                                                target="_blank">layui.com 出品</a></p>
    <p>
        <a href="http://fly.layui.com/jie/3147/" target="_blank">付费计划</a>
        <a href="http://www.layui.com/template/fly/" target="_blank">获取Fly社区模版</a>
        <a href="http://fly.layui.com/jie/2461/" target="_blank">微信公众号</a>
    </p>
</div>

<script src="${pageContext.servletContext.contextPath}/res/layui/layui.js"></script>
<script>
    layui.cache.page = 'jie';
    layui.cache.user = {
        username: '游客'
        , uid: -1
        , avatar: '${pageContext.servletContext.contextPath}/res/images/avatar/00.jpg'
        , experience: 83
        , sex: '男'
    };
    layui.config({
        version: "3.0.0"
        , base: '${pageContext.servletContext.contextPath}/res/mods/'
    }).extend({
        fly: 'index'
    }).use('fly');

    // 获取登录者信息中的飞吻
    var kissNum = '${fly_user.kissNum}';
    document.getElementById('articleForm').onsubmit = function (ev) {
        var costKiss = document.getElementById('kiss').value;
        if (parseInt(costKiss) > parseInt(kissNum)) {
            document.getElementById('kissMsg').innerHTML = '您当前只有' + parseInt(kissNum) + '飞吻数'
            return false;
        }
    }
</script>

</body>
</html>
